package com.linkoog.devtools.http.everywhere;

import com.intellij.ide.util.gotoByName.CustomMatcherModel;
import com.intellij.ide.util.gotoByName.FilteringGotoByModel;
import com.intellij.navigation.ChooseByNameContributor;
import com.intellij.navigation.NavigationItem;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class DocFilteringGotoByModel<SearchResultNavigationItem> extends FilteringGotoByModel implements DumbAware, CustomMatcherModel {
    public DocFilteringGotoByModel(@NotNull Project project, @NotNull ChooseByNameContributor[] contributors) {
        super(project, contributors);
    }

    @Nullable
    @Override
    protected SearchResultNavigationItem filterValueFor(NavigationItem item) {
        if (item == null) return null;
        return (SearchResultNavigationItem) item;
    }

    @Override
    public String getPromptText() {
        return "Enter Http Comment";
    }

    @NotNull
    @Override
    public String getNotInMessage() {
        return "No matches found in " + getProject().getName() +"	project";
    }

    @NotNull
    @Override
    public String getNotFoundMessage() {
        return "No matches found";
    }

    @Nullable
    @Override
    public String getCheckBoxName() {
        return null;
    }

    @Override
    public boolean loadInitialCheckBoxState() {
        return false;
    }

    @Override
    public void saveInitialCheckBoxState(boolean state) {
    }

    @NotNull
    @Override
    public String[] getSeparators() {
        return new String[0];
        //return new String[]{" ","/"};
    }

    @Nullable
    @Override
    public String getFullName(@NotNull Object element) {
        return getElementName(element);
    }

    @Override
    public boolean willOpenEditor() {
        return true;
    }

    @Override
    public boolean matches(@NotNull String popupItem, @NotNull String userPattern) {
        return true;
    }
}